package org.rslai.tcedit.business.impl;

import java.util.List;
import java.util.Set;
import org.rslai.tcedit.business.ProductService;
import org.rslai.tcedit.domain.Page;
import org.rslai.tcedit.domain.Product;
import org.rslai.tcedit.domain.Version;

/**
 * ProductService 接口的实现<br/>
 * 注意: <tx:annotation-driven /> 这些方法已支持事务
 * 
 * @author rslai
 * 
 * @spring.bean id="productService"
 */
public class ProductServiceImpl extends AbstractBaseService implements ProductService {

	public void create(Product product, Set<Version> versions) {
		product.setVersions(versions);
		productDao.create(product);
		entityTableDao.createEntityTable(product.getId());
	}

	public void update(Product product, Set<Version> versions) {
		product.setVersions(versions);
		productDao.update(product);
	}

	public List<Product> query(boolean asc) {
		return productDao.query(asc);
	}

	public List<Product> query(Page page, String name, String describing, boolean asc) {
		return productDao.query(page, name, describing, asc);
	}

	public void init(Product product) {
		entityTableDao.createEntityTable(product.getId());
	}

}
